package com.guli.cms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guli.cms.entity.CrmBanner;
import com.guli.cms.mapper.CrmBannerMapper;
import com.guli.cms.service.CrmBannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author ZhaoZhenyu
 * @since 2022-10-01
 */
@Service
public class CrmBannerServiceImpl extends ServiceImpl<CrmBannerMapper, CrmBanner> implements CrmBannerService {

    // 加redis缓存
    // 加双引号
    @Cacheable(value = "banner",key = "'getAllBanner'")
    @Override
    public List<CrmBanner> getAllBanner() {
        return baseMapper.selectList(new QueryWrapper<CrmBanner>().orderByAsc("sort"));
    }
}
